package com.htpay.util.sdk;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

public class HTPayClientParams {
    public HTPayClientParams() {
        super();
    }

    public HTPayClientParams(String merchantId, String channelType, String sign, String notifyUrl, String outTradeNo, String totalMoney) {
        this.merchantId = merchantId;
        this.channelType = channelType;
        this.sign = sign;
        this.notifyUrl = notifyUrl;
        this.outTradeNo = outTradeNo;
        this.totalMoney = totalMoney;
    }

    public HTPayClientParams(String merchantId, String channelType, String sign, String notifyUrl, String outTradeNo, String totalMoney, String externalParams) {
        this.merchantId = merchantId;
        this.channelType = channelType;
        this.sign = sign;
        this.notifyUrl = notifyUrl;
        this.outTradeNo = outTradeNo;
        this.totalMoney = totalMoney;
        this.externalParams = externalParams;
    }

    public HTPayClientParams(String merchantId, String channelType, String notifyUrl, String outTradeNo, String totalMoney) {
        this.merchantId = merchantId;
        this.channelType = channelType;
        this.notifyUrl = notifyUrl;
        this.outTradeNo = outTradeNo;
        this.totalMoney = totalMoney;
    }

    /**
     * 商户ID
     */
    String merchantId;

    /**
     * 通道类型:
     * <p>
     * 目前主要是支付宝H5
     */
    String channelType;

    /**
     * 签名字符串
     */
    String sign;

    /**
     * 回调通知url
     */
    String notifyUrl;

    /**
     * 商家交易订单号
     */
    String outTradeNo;

    /**
     * 交易金额
     */
    String totalMoney;

    /**
     * 额外参数包装
     */
    String externalParams;

    public String getMerchantId() {
        return merchantId;
    }

    public void setMerchantId(String merchantId) {
        this.merchantId = merchantId;
    }

    public String getChannelType() {
        return channelType;
    }

    public void setChannelType(String channelType) {
        this.channelType = channelType;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public String getNotifyUrl() {
        return notifyUrl;
    }

    public void setNotifyUrl(String notifyUrl) throws UnsupportedEncodingException {
        this.notifyUrl = URLEncoder.encode(notifyUrl, "utf-8");
    }

    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public String getTotalMoney() {
        return totalMoney;
    }

    public void setTotalMoney(String totalMoney) {
        this.totalMoney = totalMoney;
    }

    public String getExternalParams() {
        return externalParams;
    }

    public void setExternalParams(String externalParams) {
        this.externalParams = externalParams;
    }
}
